package com.kqb.sgpicturebackend.utils;

import com.kqb.sgpicturebackend.exception.BusinessException;

/**
 * @author 杉果树皮
 * @date 2025/4/28 18:07
 * @description:
 */

public class ThrowUtils {


    /**
     * 如果条件为假，则抛出业务异常
     *
     * @param condition
     * @param businessException
     */
    public static void throwIf(boolean condition, BusinessException businessException) {
        if (!condition) {
            throw businessException;
        }
    }

    /**
     * 如果条件为真，则抛出业务异常
     *
     * @param condition
     * @param businessException
     */
    public static void throwNotIf(boolean condition, BusinessException businessException) {
        if (condition) {
            throw businessException;
        }
    }
}
